function login() {
	var xmlhttp;
	try {
		xmlhttp = new XMLHttpRequest();
	}
	catch(err) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(err) {
			alert("Error, your browser does not support AJAX");
		}
	}
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			if(xmlhttp.responseText == "2") {
				window.location = "../index.php";
				//return true;
			}
			else if(xmlhttp.responseText == "1") {
				window.location = "../index.php";
				//return true;
			}
			else {
				document.getElementById("msg").innerHTML = xmlhttp.responseText;
				//return false;
			}
		}
	}
	
	var email = document.forms[0].email.value;
	var password = document.forms[0].password.value;
	var data = "email=" + email + "&password=" + password;
	
	xmlhttp.open("POST", "./login/validate_login.php", true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(data);
}